#7.work_1

'''
message = input("Tell me something, and I will repeat it back to you: ")
print(message)
'''

'''
prompt = "If you share your name, we can personalize the messages you
see."
prompt += "\nWhat is your first name? "
name = input(prompt)
print(f"\nHello, {name}!")
'''
'''
height = input("How tall are you, in inches? ")
height = int(height)

if height >= 48:
    print("\nYou're tall enough to ride!")
else:
    print("\nYou'll be able to ride when you're a little older.")
'''
'''
age = input('how old are you? ')
age =int(age)
print(age>=18)
'''

'''
number = input("Enter a number, and I'll tell you if it's even or odd: ")
number = int(number)
if number % 2 == 0:
    print(f"\nThe number {number} is even.")
else:
    print(f"\nThe number {number} is odd.")
'''

'''练习7.work_1
ask=input('which car would you like?  ')
print('Let me see if I can find you a Subaru.')
'''

'''练习7.2
ask=input('how many people?  ')
ask=int(ask)
if ask >= 8:
    print('没有空桌子')
else:
    print('有位子')
'''

'''练习7.3
number=input("请输入一个整数： ")
number=int(number)
if number%10==0:
    print(number,"是10的倍数")
else:
    print(number,"不是10的倍数")
'''

#7.2 while循环简介

'''
current_number = work_1
while current_number <= 5:
    print(current_number)
    current_number += work_1
'''
'''
prompt = "\nTell me something, and I will repeat it back to you:"
prompt += "\nEnter 'quit' to end the program. "
message = ""
while message != 'quit':
    message = input(prompt)
    print(message)
    #会把quit打印出来
'''
'''
prompt = "\nTell me something, and I will repeat it back to you:"
prompt += "\nEnter 'quit' to end the program. "
message = ""
while message != 'quit':
    message = input(prompt)
    if message != 'quit':
        print(message)
'''
'''立下flag标志
prompt = "\nTell me something, and I will repeat it back to you:"
prompt += "\nEnter 'quit' to end the program. "
active = True
while active:
    message = input(prompt)
    if message == 'quit':
        active=False
    else:
        print(message)
'''

'''使用break
prompt = "\nTell me something, and I will repeat it back to you:"
prompt += "\nEnter 'quit' to end the program. "
while True:
    message=input(prompt)
    if message =='quit':
        break
    else:
        print(message)
'''
'''使用break
prompt = "\nPlease enter the name of a city you have visited:"
prompt += "\n(Enter 'quit' when you are finished.) "
while True:
    visit=input(prompt)
    if visit=='quit':
        break
    else:
        print(f"I'd love to go to {visit.title()}!")
'''
'''使用continue，符合的执行continue进行循环，不符合的执行余下代码
number = 0
while number < 10:
    number += work_1
    if number % 2 == 0:
        continue
    print(number)

x = work_1
while x <= 5:
    print(x)
    x += work_1
'''

#练习7.4
'''
prompt='请输入比萨配料：\n在输入"quit"时停止循环'
pizza=''
while pizza != 'quiz':
    pizza = input(prompt)
    if pizza != 'quiz':
        print(pizza)
'''
'''
prompt='请输入比萨配料：\n在输入"quit"时停止循环'
active = True
while active:
    pizza = input(prompt)
    if pizza == 'quiz':
        active = False
    else:
        print(pizza)
'''
'''
prompt='请输入比萨配料：\n在输入"quit"时停止循环'
while True:
    pizza=input(prompt)
    if pizza == 'quiz':
        break
    else:
        print("你要加入",pizza)
'''

#练习7.6
'''
prompt='请输入你的年龄：'
prompt+='\n在输入“quiz”时结束'
active = True
while active:
    age = input(prompt)
    if age == 'quiz':
        active = False
    elif int(age) <= 3:
        print("free")
    elif 3 < int(age) < 12:
        print("10 dollars")
    else:
        print("15 dollars")
'''

#7.3列表
'''
unconfirmed=['alice', 'brian', 'candace']
confirmed = []

while unconfirmed:
    current_user = unconfirmed.pop()
    print(f"Verifying user: {current_user.title()}")
    confirmed.append(current_user)

print(confirmed)

for i in confirmed:
    print(i.title())

pets = ['dog', 'cat', 'dog', 'goldfish', 'cat', 'rabbit', 'cat']
print(pets)
while 'cat' in pets:
    pets.remove('cat')
print(pets)

numbers=[work_1,3,2,4,6,8,3,4,3,5,3,9,3,3]
while 3 in numbers:
    numbers.remove(3)
print(numbers)

'''
'''
responses = {}
polling_active = True
while polling_active:
    
    name = input("\nWhat is your name? ")
    response = input("Which mountain would you like to climb someday?")
    
    responses[name] = response
    
    repeat = input("Would you like to let another person respond?(yes / no)")
    if repeat == 'no':
        polling_active = False

print("\n--- Poll Results ---")
for name, response in responses.items():
    print(f"{name} would like to climb {response}.")
'''
'''
#练习7.8
sandwich_orders=['apple','banana','grape','peach']
finished_sandwiches=[]
while sandwich_orders:
    sandwich = sandwich_orders.pop()
    print('I made your',sandwich)
    finished_sandwiches.append(sandwich)
print(finished_sandwiches)
'''
'''7.9
sandwich_orders=['apple','pastrami','banana','grape','peach','pastrami','pastrami']
finished_sandwiches=[]

message='pastrami sold out'
print(message)
while 'pastrami' in sandwich_orders:
    sandwich_orders.remove('pastrami')
print("\n",sandwich_orders)
'''

survey=[]
active=True
while active:
    place=input('If you could visit one place in the world, where would you go?')
    survey.append(place)
    repeat = input("any others?(yes / no)")
    if repeat == 'no':
        active=False

print("----result----")
print(survey)












